import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect:'/home/dish'
  },
  {
    path:'/home',
    name:'home',
    component:HomeView,
    children:[
     
      {
        path:'detail',
        name:'/home/detail',
        component:()=>import('@/views/index/Detail.vue')
      },
      {
        path:'login',
        name:'/home/login',
        component:()=>import('@/views/index/Login.vue')
      },
      {
        path:'register',
        name:'/home/register',
        component:()=>import('@/views/index/Register.vue')
      },
      {
        path:'my',
        name:'/home/my',
        component:()=>import('@/views/index/My.vue')
      },
      {
        path:'dish',
        name:'/home/dish',
        component:()=>import('@/views/index/Dish.vue')
      },
      {
        path:'pay',
        name:'/home/pay',
        component:()=>import('@/views/index/Pay.vue')
      },

    ]
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
